/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package day05.sinhvien;

/**
 *
 * @author Administrator
 */
public class BangDiem {

    private int toan;
    private int ly;
    private int hoa;

    public BangDiem(int toan, int ly, int hoa) {

        if (toan > 10 || toan < 0) {
            this.toan = 0;
        } else {
            this.toan = toan;
        }
        if (ly > 10 || ly < 0) {
            this.ly = 0;
        } else {
            this.ly = ly;
        }
        if (hoa > 10 || hoa < 0) {
            this.hoa = 0;
        } else {
            this.hoa = hoa;
        }
    }
    /*
     * toString
     */

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(this.toan);
        sb.append(",");
        sb.append(this.ly);
        sb.append(",");
        sb.append(this.hoa);
        return sb.toString();
    }
/*
 * Tinh tong diem
 */    
  public  int tinhTongDiem() {
        return this.toan + this.ly + this.hoa;
    }

   public boolean ktDauRot() {
        return this.tinhTongDiem()>=17 && 
               this.toan>=5 && this.ly>=5 && this.hoa>=5;
    }
    
    
}
